﻿@model Affiliation
@inject Microsoft.Extensions.FileProviders.IWwwrootFileProvider Wwwroot
@inject IMenuProvider Menu
@{
    ViewData["Title"] = "Affiliation: " + Model.Name;
}

<h2 class="mt-2">@ViewData["Title"]</h2>

<div class="row">
    <div class="col-lg-4">
        <table class="table table-sm table-striped">
            <tr><th>ID</th><td>@Model.Id</td></tr>
            <tr><th>Shortname</th><td>@Model.Abbreviation</td></tr>
            <tr><th>Name</th><td>@Model.Name</td></tr>
            <tr><th>Country</th><td title="@(TenantDefaults.Countries.GetValueOrDefault(Model.CountryCode ?? "") ?? "")"><img height="30" asp-show-if="Model.CountryCode != null && TenantDefaults.EnableCountryLogo" src="/lib/country-flags/@(Model.CountryCode).png" /> @(Model.CountryCode ?? "(not specified)")</td></tr>
            <tr><th>Student email suffix</th><td>@(Model.EmailSuffix ?? "(none)")</td></tr>
            <tr><th>Logo</th><td id="aff-logo"><img src="~/images/affiliations/@(Model.Abbreviation).png" width="40" height="40" onerror="$('#aff-logo').html('<b class=text-danger>(no logo)</b>')" /></td></tr>
        </table>
    </div>
</div>

<p>
    <a asp-route-affid="@Model.Id" asp-action="Edit" class="btn btn-primary" title="Edit"><i class="fas fa-edit"></i>&nbsp;Edit</a>
    <a asp-route-affid="@Model.Id" asp-action="Delete" class="btn btn-danger" title="Delete"><i class="fas fa-trash-alt"></i>&nbsp;Delete</a>
</p>

@await Menu.Extend(TenantDefaults.AffiliationAttach).RenderAsync(Component, new { aff = Model })